<?php
class Exam extends IController{
    public function regis(){
        $this->redirect("regis");
    }
    public function act(){
        $id = $_GET['id'];
        $id = base64_decode($id);
        $arr = array('status'=>1);
        $model = new IModel("b2");
        $model->setData($arr);
        $res = $model->update("id=$id");
        if($res){
            $this->redirect("login");
        }
    }
    public function register()
    {
        $name = IReq::get("name");
        $pwd = IReq::get("pwd");
        $email = $_POST['email'];
        $arr = array('name' => $name, 'pwd' => $pwd, 'email' => $email, 'status' => 0);
        $model = new IModel("b2");
        $model->setData($arr);
        $res = $model->add();
        if ($res) {
            $title = "欢迎注册成为我们网站的会员";
            $url = "http://www.iwebshop.com/index.php/exam/act/id/" .base64_encode($res);
            $conter = "请点击此链接激活加入我们！" . $url;
            $mail = new SendMail();
            $mail->send($eamil, $title, $conter);
        }
    }
        public function login_do(){
            $name = IReq::get("name");
            $pwd = IReq::get("pwd");
            $model = new IModel("b2");
            $res = $model->query("name='$name' and pwd='$pwd'");
            $status = $res[0]['status'];
            if($status==1){
                echo "登陆成功";
            }else{
                echo "您未激活，请去邮箱激活";
            }
        }
}


